/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "valor_atributo_plan")
@NamedQueries({
    @NamedQuery(name = "ValorAtributoPlan.findAll", query = "SELECT v FROM ValorAtributoPlan v"),
    @NamedQuery(name = "ValorAtributoPlan.findByIdValorAtributoPlan", query = "SELECT v FROM ValorAtributoPlan v WHERE v.idValorAtributoPlan = :idValorAtributoPlan"),
    @NamedQuery(name = "ValorAtributoPlan.findByValor", query = "SELECT v FROM ValorAtributoPlan v WHERE v.valor = :valor")})
public class ValorAtributoPlan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_valor_atributo_plan")
    private Integer idValorAtributoPlan;
    @Basic(optional = false)
    @Column(name = "valor")
    private String valor;
    @JoinColumn(name = "fid_plan", referencedColumnName = "id_plan")
    @ManyToOne(optional = false)
    private Plan plan;
    @JoinColumn(name = "fid_atributo", referencedColumnName = "id_atributo")
    @ManyToOne(optional = false)
    private Atributo atributo;

    public ValorAtributoPlan() {
    }

    public ValorAtributoPlan(Integer idValorAtributoPlan) {
        this.idValorAtributoPlan = idValorAtributoPlan;
    }

    public ValorAtributoPlan(Integer idValorAtributoPlan, String valor) {
        this.idValorAtributoPlan = idValorAtributoPlan;
        this.valor = valor;
    }

    public Integer getIdValorAtributoPlan() {
        return idValorAtributoPlan;
    }

    public void setIdValorAtributoPlan(Integer idValorAtributoPlan) {
        this.idValorAtributoPlan = idValorAtributoPlan;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public Plan getPlan() {
        return plan;
    }

    public void setPlan(Plan plan) {
        this.plan = plan;
    }

    public Atributo getAtributo() {
        return atributo;
    }

    public void setAtributo(Atributo atributo) {
        this.atributo = atributo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idValorAtributoPlan != null ? idValorAtributoPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ValorAtributoPlan)) {
            return false;
        }
        ValorAtributoPlan other = (ValorAtributoPlan) object;
        if ((this.idValorAtributoPlan == null && other.idValorAtributoPlan != null) || (this.idValorAtributoPlan != null && !this.idValorAtributoPlan.equals(other.idValorAtributoPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.ValorAtributoPlan[idValorAtributoPlan=" + idValorAtributoPlan + "]";
    }

}
